package http;

public class HttpClientTest {
	
	public static void main(String[] args) throws Exception 
	{ 
	/*
	HttpClient client = new HttpClient(); 
	// Set Cookie 
	client.getParams().setCookiePolicy(CookiePolicy.RFC_2109); 
	HttpState initialState = new HttpState(); 
	Cookie cookie = new Cookie(); 
	cookie.setDomain("group.bj.chinamobile.com"); 
	cookie.setPath("/"); 
	cookie.setName("JSESSIONID"); 
	cookie.setValue("0000_jiLQsJSN3bm1gh50AUoZgY:11e205r4h"); 
	initialState.addCookie(cookie); 
	client.setState(initialState); 
	// End 
	client.getHostConfiguration().setHost("group.bj.chinamobile.com", 80, 
	"http"); 
	HttpMethod method = getPostMethod(); // 使用 POST 方式提交数据 
	client.executeMethod(method); // 打印服务器返回的状态 
	System.out.println(method.getStatusLine()); // 打印结果页面 
	String response = new String(method.getResponseBodyAsString().getBytes( 
	"8859_1")); 
	// 打印返回的信息 
	System.out.println(response); 
	method.releaseConnection(); 
	} 

	private static HttpMethod getPostMethod() 
	{ 
	PostMethod post = new PostMethod("/edsmp/LinkmanSave.do"); 
	NameValuePair name = new NameValuePair("name", "Sotier_Yan"); 
	NameValuePair mphone = new NameValuePair("mphone", "13566667777"); 
	NameValuePair agroupid = new NameValuePair("agroupid", "22508551"); 
	post.setRequestBody(new NameValuePair[] 
	{ name, mphone, agroupid }); 
	return post; 
	*/
	} 

}
